home *** CD-ROM | disk | FTP | other *** search
Text File | 2000-07-18 | 43.4 KB | 1,188 lines |
- // rb_plugin.h
- //
- // This file is part of the REALbasic plugin API.
- //
- // © 1997-2000 REAL Software Inc. -- All Rights Reserved
-
- #include "REALplugin.h"
- #ifndef WIN32
- #if !CARBON // May 03 2000 -- GCC (1)
- #include <A4Stuff.h>
- #include <SetupA4.h>
- #endif // May 03 2000 -- GCC (1)
- #endif
- #include "rb_plugin.h"
-
- #ifndef WIN32
- #ifndef powerc
- #define USECALLSHELL
- #endif
- #endif
-
- static void *(*gResolver)(const char *entryName);
-
- #ifdef powerc
- static void *(*gResolverPPC)(const char *entryName);
- #endif
-
- // static Ptr *gA4Stack;
- static unsigned long a4stack;
-
- #ifdef powerc
- int __procinfo = kThinkCStackBased | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(4));
- #endif
-
- #ifdef powerc
- //#define CallResolver(a) CallUniversalProc((RoutineDescriptor *) gResolver, kThinkCStackBased | RESULT_SIZE(SIZE_CODE(4)) | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(4)), a)
- //#define Caller(func, upp) CallUniversalProc((RoutineDescriptor *) func, upp,
- #define CallResolver(a) gResolverPPC(a)
- #else
- #define CallResolver(a) gResolver(a)
- #endif
-
- #ifdef USECALLSHELL
- static REALproc buildEnvironmentShell(void *func)
- {
- short *glue;
- REALproc proc;
- unsigned long originalCode;
- unsigned long unglue;
- unsigned long pluginA4 = GetCurrentA4();
-
- static int gRemainAllocCount;
- static Ptr gRemainAllocPtr;
-
- if (!func)
- return nil;
- if (func == REALstandardGetter)
- return REALstandardGetter;
-
- originalCode = (unsigned long) func;
- if (!gRemainAllocCount)
- {
- gRemainAllocCount = 8;
- gRemainAllocPtr = NewPtr(8 * 52);
- }
-
- glue = (short *) gRemainAllocPtr;
- gRemainAllocPtr += 52;
- gRemainAllocCount--;
- proc = (REALproc) glue;
-
- unglue = (unsigned long) (glue + 17);
-
- *glue++ = 0x2079; // movea.l $, A0
- *glue++ = a4stack >> 16;
- *glue++ = a4stack & 0xffff;
- *glue++ = 0x210c; // move.l A4, -(A0)
- *glue++ = 0x211f; // move.l (A7)+, -(A0)
- *glue++ = 0x287c; // move.l #, A4
- *glue++ = pluginA4 >> 16;
- *glue++ = pluginA4 & 0xffff;
- *glue++ = 0x2f3c; // move.l #, -(A7)
- *glue++ = unglue >> 16;
- *glue++ = unglue & 0xffff;
- *glue++ = 0x23c8; // move.l A0, $
- *glue++ = a4stack >> 16;
- *glue++ = a4stack & 0xffff;
- *glue++ = 0x4ef9; // jmp $
- *glue++ = originalCode >> 16;
- *glue++ = originalCode & 0xffff;
-
- *glue++ = 0x2279; // movea.l $, A1
- *glue++ = a4stack >> 16;
- *glue++ = a4stack & 0xffff;
- *glue++ = 0x2f19; // move.l (A1)+,-(A7)
- *glue++ = 0x2859; // movea.l (A1)+, A4
- *glue++ = 0x23c9; // move.l A1, $
- *glue++ = a4stack >> 16;
- *glue++ = a4stack & 0xffff;
- *glue++ = 0x4e75; // rts
-
- return proc;
- }
- #endif
-
- #pragma mark -
- #pragma mark PAM Code Below!
- #pragma mark -
- // **** Autogenerated code from Plugin API Manager follows ****
- // *************** Do not edit below this line ****************
-
- #if TARGET_68K || TARGET_PPC
- QDGlobals *REALQDGlobals(void)
- {
- static unsigned long (*pQDGlobals)(void) = nil;
- if (!pQDGlobals)
- pQDGlobals = (unsigned long (*)(void)) CallResolver("REALQDGlobals");
- if (pQDGlobals) return (QDGlobals *)pQDGlobals();
- else return (QDGlobals *)0;
- }
- #endif
-
- #if TARGET_68K || TARGET_PPC || TARGET_CARBON
- int REALallocateMenuID(void)
- {
- static int (*pAllocateMenuID)(void) = nil;
- if (!pAllocateMenuID)
- pAllocateMenuID = (int (*)(void)) CallResolver("allocateMenuID");
- if (pAllocateMenuID) return pAllocateMenuID();
- else return (int)0;
- }
- #endif
-
- Boolean REALinRuntime(void)
- {
- static Boolean (*pInRuntime)(void) = nil;
- if (!pInRuntime)
- pInRuntime = (Boolean (*)(void)) CallResolver("REALinRuntime");
- if (pInRuntime) return pInRuntime();
- else return (Boolean)0;
- }
-
- #if TARGET_68K || TARGET_PPC || TARGET_CARBON
- void REALreleaseMenuID(int id)
- {
- static void (*pReleaseMenuID)(int) = nil;
- if (!pReleaseMenuID)
- pReleaseMenuID = (void (*)(int)) CallResolver("releaseMenuID");
- if (pReleaseMenuID) pReleaseMenuID(id);
- }
- #endif
-
- void GraphicsDrawLine(REALgraphics graphicsObject, int x1, int y1, int x2, int y2)
- {
- static void (*pGraphicsDrawLine)(REALgraphics, int, int, int, int) = nil;
- if (!pGraphicsDrawLine)
- pGraphicsDrawLine = (void (*)(REALgraphics, int, int, int, int)) CallResolver("RuntimeGraphicsDrawLine");
- if (pGraphicsDrawLine) pGraphicsDrawLine(graphicsObject, x1, y1, x2, y2);
- }
-
- void REALRegisterMethod(REALmethodDefinition *defn)
- {
- static void (*pRuntimeRegisterMethod)(REALmethodDefinition *defn);
- if (!pRuntimeRegisterMethod)
- pRuntimeRegisterMethod = (void (*)(REALmethodDefinition *)) CallResolver("PluginRegisterMethod");
- #ifdef USECALLSHELL
- defn->function = buildEnvironmentShell(defn->function);
- defn->setterFunction = buildEnvironmentShell(defn->setterFunction);
- #endif
- pRuntimeRegisterMethod(defn);
- }
-
- void REALRegisterControl(REALcontrol *defn)
- {
- static void (*pRuntimeRegisterControl)(REALcontrol *defn);
- if (!pRuntimeRegisterControl)
- pRuntimeRegisterControl = (void (*)(REALcontrol *)) CallResolver("PluginRegisterControl");
- #ifdef USECALLSHELL
- int i;
- for (i = 0; i < defn->propertyCount; i++)
- {
- defn->properties[i].getter = buildEnvironmentShell(defn->properties[i].getter);
- defn->properties[i].setter = buildEnvironmentShell(defn->properties[i].setter);
- }
- for (i = 0; i < defn->methodCount; i++)
- {
- defn->methods[i].function = buildEnvironmentShell(defn->methods[i].function);
- defn->methods[i].setterFunction = buildEnvironmentShell(defn->methods[i].setterFunction);
- }
- defn->behaviour->constructorFunction = (void (*)(REALcontrolInstance)) buildEnvironmentShell(defn->behaviour->constructorFunction);
- defn->behaviour->destructorFunction = (void (*)(REALcontrolInstance)) buildEnvironmentShell(defn->behaviour->destructorFunction);
- defn->behaviour->redrawFunction = (void (*)(REALcontrolInstance)) buildEnvironmentShell(defn->behaviour->redrawFunction);
- defn->behaviour->clickFunction = (Boolean (*)(REALcontrolInstance, int, int, int)) buildEnvironmentShell(defn->behaviour->clickFunction);
- defn->behaviour->mouseDragFunction = (void (*)(REALcontrolInstance, int, int)) buildEnvironmentShell(defn->behaviour->mouseDragFunction);
- defn->behaviour->mouseUpFunction = (void (*)(REALcontrolInstance, int, int)) buildEnvironmentShell(defn->behaviour->mouseUpFunction);
- defn->behaviour->gainedFocusFunction = (void (*)(REALcontrolInstance)) buildEnvironmentShell(defn->behaviour->gainedFocusFunction);
- defn->behaviour->lostFocusFunction = (void (*)(REALcontrolInstance)) buildEnvironmentShell(defn->behaviour->lostFocusFunction);
- defn->behaviour->keyDownFunction = buildEnvironmentShell(defn->behaviour->keyDownFunction);
- defn->behaviour->openFunction = (void (*)(REALcontrolInstance)) buildEnvironmentShell(defn->behaviour->openFunction);
- defn->behaviour->closeFunction = (void (*)(REALcontrolInstance)) buildEnvironmentShell(defn->behaviour->closeFunction);
- defn->behaviour->backgroundIdleFunction = (void (*)(REALcontrolInstance)) buildEnvironmentShell(defn->behaviour->backgroundIdleFunction);
- defn->behaviour->drawOffscreenFunction = (void (*)(REALcontrolInstance, REALgraphics)) buildEnvironmentShell(defn->behaviour->drawOffscreenFunction);
- defn->behaviour->setSpecialBackground = (void (*)(REALcontrolInstance)) buildEnvironmentShell(defn->behaviour->setSpecialBackground);
- defn->behaviour->constantChanging = (void (*)(REALcontrolInstance, REALstring)) buildEnvironmentShell(defn->behaviour->constantChanging);
- defn->behaviour->droppedNewInstance = (void (*)(REALcontrolInstance)) buildEnvironmentShell(defn->behaviour->droppedNewInstance);
- #endif
- pRuntimeRegisterControl(defn);
- }
-
- void REALRegisterClassExtension(REALclassDefinition *defn)
- {
- static void (*pRegisterClassExtension)(REALclassDefinition *defn);
- if (!pRegisterClassExtension)
- pRegisterClassExtension = (void (*)(REALclassDefinition *)) CallResolver("PluginRegisterClassExtension");
- #ifdef USECALLSHELL
- int i;
- for (i = 0; i < defn->propertyCount; i++)
- {
- defn->properties[i].getter = buildEnvironmentShell(defn->properties[i].getter);
- defn->properties[i].setter = buildEnvironmentShell(defn->properties[i].setter);
- }
- for (i = 0; i < defn->methodCount; i++)
- {
- defn->methods[i].function = buildEnvironmentShell(defn->methods[i].function);
- defn->methods[i].setterFunction = buildEnvironmentShell(defn->methods[i].setterFunction);
- }
- #endif
- if (pRegisterClassExtension)
- pRegisterClassExtension(defn);
- }
-
- void REALRegisterDBEngine(REALdbEngineDefinition *defn)
- {
- static void (*pRegisterDatabaseEngine)(REALdbEngineDefinition *defn);
- if (!pRegisterDatabaseEngine)
- pRegisterDatabaseEngine = (void (*)(REALdbEngineDefinition *)) CallResolver("PluginRegisterDBEngine");
- #ifdef USECALLSHELL
- defn->closeDatabase = (void (*)(dbDatabase *)) buildEnvironmentShell(defn->closeDatabase);
- defn->getTableSchemaCursor = (REALdbCursor (*)(dbDatabase *)) buildEnvironmentShell(defn->getTableSchemaCursor);
- defn->getFieldSchemaCursor = (REALdbCursor (*)(dbDatabase *, REALstring)) buildEnvironmentShell(defn->getFieldSchemaCursor);
- defn->directSQLSelect = (REALdbCursor (*)(dbDatabase *, REALstring)) buildEnvironmentShell(defn->directSQLSelect);
- defn->directSQLExecute = (void (*)(dbDatabase *, REALstring)) buildEnvironmentShell(defn->directSQLExecute);
- defn->createTable = (void (*)(dbDatabase *, REALstring, REALnewColumn *, unsigned char *, int)) buildEnvironmentShell(defn->createTable);
- defn->addTableRecord = (void (*)(dbDatabase *, REALstring, REALcolumnValue *)) buildEnvironmentShell(defn->addTableRecord);
- defn->getTableCursor = (REALdbCursor (*)(dbDatabase *, REALstring, REALgetColumn *, REALcolumnConstraints *)) buildEnvironmentShell(defn->getTableCursor);
- defn->updateFields = (void (*)(dbDatabase *, REALfieldUpdate *)) buildEnvironmentShell(defn->updateFields);
- defn->addTableColumn = (void (*)(dbDatabase *, REALstring, REALnewColumn *)) buildEnvironmentShell(defn->addTableColumn);
- defn->getDatabaseIndexes = (REALdbCursor (*)(dbDatabase *, REALstring)) buildEnvironmentShell(defn->getDatabaseIndexes);
- defn->getLastErrorCode = (long (*)(dbDatabase *)) buildEnvironmentShell(defn->getLastErrorCode);
- defn->getLastErrorString = (REALstring (*)(dbDatabase *)) buildEnvironmentShell(defn->getLastErrorString);
- defn->commit = (void (*)(dbDatabase *)) buildEnvironmentShell(defn->commit);
- defn->rollback = (void (*)(dbDatabase *)) buildEnvironmentShell(defn->rollback);
- defn->getProperty = (REALstring (*)(dbDatabase *, REALstring)) buildEnvironmentShell(defn->getProperty);
- #endif
- if (pRegisterDatabaseEngine)
- pRegisterDatabaseEngine(defn);
- }
-
- void REALRegisterDBTable(REALdbTableDefinition *defn)
- {
- static void (*pRegisterDBTable)(REALdbTableDefinition *defn);
- if (!pRegisterDBTable)
- pRegisterDBTable = (void (*)(REALdbTableDefinition *)) CallResolver("PluginRegisterDBTable");
- if (pRegisterDBTable)
- pRegisterDBTable(defn);
- }
-
- void REALRegisterDBCursor(REALdbCursorDefinition *defn)
- {
- static void (*pRegisterDBCursor)(REALdbCursorDefinition *defn);
- if (!pRegisterDBCursor)
- pRegisterDBCursor = (void (*)(REALdbCursorDefinition *)) CallResolver("PluginRegisterDBCursor");
- #ifdef USECALLSHELL
- defn->closeCursor = (void (*)(dbCursor *)) buildEnvironmentShell(defn->closeCursor);
- defn->cursorColumnCount = (int (*)(dbCursor *)) buildEnvironmentShell(defn->cursorColumnCount);
- defn->cursorColumnName = (REALstring (*)(dbCursor *, int column)) buildEnvironmentShell(defn->cursorColumnName);
- defn->cursorRowCount = (int (*)(dbCursor *)) buildEnvironmentShell(defn->cursorRowCount);
- defn->cursorColumnValue = (void (*)(dbCursor *, int, Ptr *, dbFieldType *, int *)) buildEnvironmentShell(defn->cursorColumnValue);
- defn->cursorReleaseValue = (void (*)(dbCursor *)) buildEnvironmentShell(defn->cursorReleaseValue);
- defn->cursorNextRow = (Boolean (*)(dbCursor *)) buildEnvironmentShell(defn->cursorNextRow);
- defn->cursorDelete = (void (*)(dbCursor *)) buildEnvironmentShell(defn->cursorDelete);
- defn->cursorDeleteAll = (void (*)(dbCursor *)) buildEnvironmentShell(defn->cursorDeleteAll);
- #endif
- if (pRegisterDBCursor)
- pRegisterDBCursor(defn);
- }
-
- void REALRegisterClass(REALclassDefinition *defn)
- {
- static void (*pRegisterClass)(REALclassDefinition *defn);
- if (!pRegisterClass)
- pRegisterClass = (void (*)(REALclassDefinition *)) CallResolver("PluginRegisterClass");
- #ifdef USECALLSHELL
- int i;
- defn->constructor = buildEnvironmentShell(defn->constructor);
- defn->destructor = buildEnvironmentShell(defn->destructor);
- for (i = 0; i < defn->propertyCount; i++)
- {
- defn->properties[i].getter = buildEnvironmentShell(defn->properties[i].getter);
- defn->properties[i].setter = buildEnvironmentShell(defn->properties[i].setter);
- }
- for (i = 0; i < defn->methodCount; i++)
- {
- defn->methods[i].function = buildEnvironmentShell(defn->methods[i].function);
- defn->methods[i].setterFunction = buildEnvironmentShell(defn->methods[i].setterFunction);
- }
- for (i = 0; i < defn->eventInstanceCount; i++)
- defn->eventInstances[i].implementation = buildEnvironmentShell(defn->eventInstances[i].implementation);
- #endif
- if (pRegisterClass)
- pRegisterClass(defn);
- }
-
- const char *REALCString(REALstring str)
- {
- static unsigned long (*pCString)(REALstring) = nil;
- if (!pCString)
- pCString = (unsigned long (*)(REALstring)) CallResolver("StringGetCString");
- if (pCString) return (const char *)pCString(str);
- else return (const char *)0;
- }
-
- const unsigned char *REALPString(REALstring str)
- {
- static unsigned long (*pPString)(REALstring) = nil;
- if (!pPString)
- pPString = (unsigned long (*)(REALstring)) CallResolver("StringGetPString");
- if (pPString) return (const unsigned char *)pPString(str);
- else return (const unsigned char *)0;
- }
-
- REALstring REALInterpretConstantValue(REALstring value)
- {
- static REALstring (*pInterpretConstantValue)(REALstring);
- if (!pInterpretConstantValue)
- pInterpretConstantValue = (REALstring (*)(REALstring)) CallResolver("PluginInterpretConstantValue");
- if (!pInterpretConstantValue)
- {
- REALLockString(value);
- return value;
- }
- return pInterpretConstantValue(value);
- }
-
- REALstring REALDefaultControlFont(void)
- {
- static unsigned long (*pDefaultControlFont)(void) = nil;
- if (!pDefaultControlFont)
- pDefaultControlFont = (unsigned long (*)(void)) CallResolver("PluginDefaultControlFont");
- if (pDefaultControlFont) return (REALstring)pDefaultControlFont();
- else return (REALstring)0;
- }
-
- REALstring REALDefaultControlCaption(void)
- {
- static unsigned long (*pDefaultControlCaption)(void) = nil;
- if (!pDefaultControlCaption)
- pDefaultControlCaption = (unsigned long (*)(void)) CallResolver("PluginDefaultControlCaption");
- if (pDefaultControlCaption) return (REALstring)pDefaultControlCaption();
- else return (REALstring)0;
- }
-
- unsigned long REALDefaultControlFontSize(void)
- {
- static unsigned long (*pDefaultControlFontSize)(void) = nil;
- if (!pDefaultControlFontSize)
- pDefaultControlFontSize = (unsigned long (*)(void)) CallResolver("PluginDefaultControlFontSize");
- if (pDefaultControlFontSize) return pDefaultControlFontSize();
- else return (unsigned long)0;
- }
-
- REALstring REALBuildString(const char *contents, int length)
- {
- static unsigned long (*pBuildString)(const char *, int) = nil;
- if (!pBuildString)
- pBuildString = (unsigned long (*)(const char *, int)) CallResolver("REALBuildString");
- if (pBuildString) return (REALstring)pBuildString(contents, length);
- else return (REALstring)0;
- }
-
- void REALLockObject(REALobject obj)
- {
- static void (*pLockObject)(REALobject) = nil;
- if (!pLockObject)
- pLockObject = (void (*)(REALobject)) CallResolver("REALLockObject");
- if (pLockObject) pLockObject(obj);
- }
-
- void REALUnlockObject(REALobject obj)
- {
- static void (*pUnlockObject)(REALobject) = nil;
- if (!pUnlockObject)
- pUnlockObject = (void (*)(REALobject)) CallResolver("REALUnlockObject");
- if (pUnlockObject) pUnlockObject(obj);
- }
-
- void REALLockString(REALstring str)
- {
- static void (*pLockString)(REALstring) = nil;
- if (!pLockString)
- pLockString = (void (*)(REALstring)) CallResolver("REALLockString");
- if (pLockString) pLockString(str);
- }
-
- void REALUnlockString(REALstring str)
- {
- static void (*pUnlockString)(REALstring) = nil;
- if (!pUnlockString)
- pUnlockString = (void (*)(REALstring)) CallResolver("REALUnlockString");
- if (pUnlockString) pUnlockString(str);
- }
-
- REALproc REALInterfaceRoutine(REALobject obj, const char *interfaceName, const char *methodName)
- {
- static unsigned long (*pInterfaceRoutine)(REALobject, const char *, const char *) = nil;
- if (!pInterfaceRoutine)
- pInterfaceRoutine = (unsigned long (*)(REALobject, const char *, const char *)) CallResolver("GetInterfaceRoutine");
- if (pInterfaceRoutine) return (REALproc)pInterfaceRoutine(obj, interfaceName, methodName);
- else return (REALproc)0;
- }
-
- #if TARGET_68K || TARGET_PPC || TARGET_CARBON
- REALpicture REALBuildPictureFromPicHandle(PicHandle pic, Boolean bPassOwnership)
- {
- static unsigned long (*pBuildPictureFromPicHandle)(PicHandle, Boolean) = nil;
- if (!pBuildPictureFromPicHandle)
- pBuildPictureFromPicHandle = (unsigned long (*)(PicHandle, Boolean)) CallResolver("REALBuildPictureFromPicHandle");
- if (pBuildPictureFromPicHandle) return (REALpicture)pBuildPictureFromPicHandle(pic, bPassOwnership);
- else return (REALpicture)0;
- }
- #endif
-
- #if TARGET_68K || TARGET_PPC || TARGET_CARBON
- REALpicture REALBuildPictureFromGWorld(GWorldPtr world, Boolean bPassOwnership)
- {
- static unsigned long (*pBuildPictureFromGWorld)(GWorldPtr, Boolean) = nil;
- if (!pBuildPictureFromGWorld)
- pBuildPictureFromGWorld = (unsigned long (*)(GWorldPtr, Boolean)) CallResolver("REALBuildPictureFromGWorld");
- if (pBuildPictureFromGWorld) return (REALpicture)pBuildPictureFromGWorld(world, bPassOwnership);
- else return (REALpicture)0;
- }
- #endif
-
- REALpicture REALBuildPictureFromPictureDescription(REALpictureDescription *description, Boolean bPassOwnership)
- {
- static unsigned long (*pBuildPictureFromPictureDescription)(REALpictureDescription *, Boolean) = nil;
- if (!pBuildPictureFromPictureDescription)
- pBuildPictureFromPictureDescription = (unsigned long (*)(REALpictureDescription *, Boolean)) CallResolver("REALBuildPictureFromPictureDescription");
- if (pBuildPictureFromPictureDescription) return (REALpicture)pBuildPictureFromPictureDescription(description, bPassOwnership);
- else return (REALpicture)0;
- }
-
- void REALLockPictureDescription(REALpicture pic, REALpictureDescription *description)
- {
- static void (*pLockPictureDescription)(REALpicture, REALpictureDescription *) = nil;
- if (!pLockPictureDescription)
- pLockPictureDescription = (void (*)(REALpicture, REALpictureDescription *)) CallResolver("lockPictureDescription");
- if (pLockPictureDescription) pLockPictureDescription(pic, description);
- }
-
- void REALUnlockPictureDescription(REALpicture pic)
- {
- static void (*pUnlockPictureDescription)(REALpicture) = nil;
- if (!pUnlockPictureDescription)
- pUnlockPictureDescription = (void (*)(REALpicture)) CallResolver("unlockPictureDescription");
- if (pUnlockPictureDescription) pUnlockPictureDescription(pic);
- }
-
- void REALLockSoundDescription(REALsound sound, REALsoundDescription *description)
- {
- static void (*pLockSoundDescription)(REALsound, REALsoundDescription *) = nil;
- if (!pLockSoundDescription)
- pLockSoundDescription = (void (*)(REALsound, REALsoundDescription *)) CallResolver("");
- if (pLockSoundDescription) pLockSoundDescription(sound, description);
- }
-
- void REALUnlockSoundDescription(REALsound sound)
- {
- static void (*pUnlockSoundDescription)(REALsound) = nil;
- if (!pUnlockSoundDescription)
- pUnlockSoundDescription = (void (*)(REALsound)) CallResolver("unlockPictureDescription");
- if (pUnlockSoundDescription) pUnlockSoundDescription(sound);
- }
-
- void REALPictureClearCache(REALpicture pic)
- {
- static void (*pPictureClearCache)(REALpicture) = nil;
- if (!pPictureClearCache)
- pPictureClearCache = (void (*)(REALpicture)) CallResolver("REALPictureClearCache");
- if (pPictureClearCache) pPictureClearCache(pic);
- }
-
- #if TARGET_WIN32
- void REALDrawPicturePrimitive(HDC hDC, REALpicture pic, const Rect *rBounds, int bTransparent)
- {
- static void (*pDrawPicturePrimitive)(HDC, REALpicture, const Rect *, int) = nil;
- if (!pDrawPicturePrimitive)
- pDrawPicturePrimitive = (void (*)(HDC, REALpicture, const Rect *, int)) CallResolver("drawPicturePrimitive");
- if (pDrawPicturePrimitive) pDrawPicturePrimitive(hDC, pic, rBounds, bTransparent);
- }
- #endif
-
- #if TARGET_68K || TARGET_PPC || TARGET_CARBON
- void REALDrawPicturePrimitive(REALpicture pic, const Rect *rBounds, int bTransparent)
- {
- static void (*pDrawPicturePrimitive)(REALpicture, const Rect *, int) = nil;
- if (!pDrawPicturePrimitive)
- pDrawPicturePrimitive = (void (*)(REALpicture, const Rect *, int)) CallResolver("drawPicturePrimitive");
- if (pDrawPicturePrimitive) pDrawPicturePrimitive(pic, rBounds, bTransparent);
- }
- #endif
-
- REALdbCursor REALdbCursorFromDBCursor(dbCursor *cursor, REALdbCursorDefinition *defn)
- {
- static REALdbCursor (*pDbCursorFromDBCursor)(dbCursor *, REALdbCursorDefinition *) = nil;
- if (!pDbCursorFromDBCursor)
- pDbCursorFromDBCursor = (REALdbCursor (*)(dbCursor *, REALdbCursorDefinition *)) CallResolver("REALdbCursorFromDBCursor");
- if (pDbCursorFromDBCursor) return pDbCursorFromDBCursor(cursor, defn);
- else return (REALdbCursor)0;
- }
-
- REALdbDatabase REALdbDatabaseFromDBDatabase(dbDatabase *database, REALdbEngineDefinition *defn)
- {
- static REALdbDatabase (*pDbDatabaseFromDBDatabase)(dbDatabase *, REALdbEngineDefinition *) = nil;
- if (!pDbDatabaseFromDBDatabase)
- pDbDatabaseFromDBDatabase = (REALdbDatabase (*)(dbDatabase *, REALdbEngineDefinition *)) CallResolver("REALdbDatabaseFromDBDatabase");
- if (pDbDatabaseFromDBDatabase) return pDbDatabaseFromDBDatabase(database, defn);
- else return (REALdbDatabase)0;
- }
-
- void *REALGetEventInstance(REALcontrolInstance instance, REALevent *event)
- {
- static void *(*pGetEventInstance)(REALcontrolInstance instance, int builtHook);
- #ifdef powerc
- if (!pGetEventInstance)
- pGetEventInstance = (void *(*)(REALcontrolInstance,int)) CallResolver("GetEventInstancePPC");
- return (void *) pGetEventInstance(instance, event->forSystemUse);
- #else
- if (!pGetEventInstance)
- pGetEventInstance = (void *(*)(REALcontrolInstance,int)) CallResolver("GetEventInstance");
- return (void *) pGetEventInstance(instance, event->forSystemUse);
- #endif
- }
-
- #if TARGET_68K || TARGET_PPC || TARGET_CARBON
- void REALRegisterEventFilter(REALEventCallback callback, long param)
- {
- static void (*pRegisterEventFilter)(REALEventCallback, long param);
- #ifdef powerc
- if (!pRegisterEventFilter)
- pRegisterEventFilter = (void (*)(REALEventCallback, long)) CallResolver("PluginRegisterEventFilterPPC");
- #else
- if (!pRegisterEventFilter)
- pRegisterEventFilter = (void (*)(REALEventCallback, long)) CallResolver("PluginRegisterEventFilter");
- #endif
- pRegisterEventFilter(callback, param);
- }
- #endif
-
- void *REALGetControlData(REALcontrolInstance instance, REALcontrol *defn)
- {
- return ((Ptr) instance) + defn->forSystemUse;
- }
-
- void *REALGetClassData(REALobject instance, REALclassDefinition *defn)
- {
- return ((Ptr) instance) + defn->forSystemUse;
- }
-
- void REALGetControlBounds(REALcontrolInstance instance, Rect *rBounds)
- {
- static void (*pGetControlBounds)(REALcontrolInstance, Rect *) = nil;
- if (!pGetControlBounds)
- pGetControlBounds = (void (*)(REALcontrolInstance, Rect *)) CallResolver("GetControlBounds");
- if (pGetControlBounds) pGetControlBounds(instance, rBounds);
- }
-
- long REALGetControlVisible(REALcontrolInstance instance)
- {
- static long (*pGetControlVisible)(REALcontrolInstance) = nil;
- if (!pGetControlVisible)
- pGetControlVisible = (long (*)(REALcontrolInstance)) CallResolver("GetControlVisible");
- if (pGetControlVisible) return pGetControlVisible(instance);
- else return (long)0;
- }
-
- Boolean REALGetControlEnabled(REALcontrolInstance instance)
- {
- static int (*pGetControlEnabled)(REALcontrolInstance, long);
- if (!pGetControlEnabled)
- pGetControlEnabled = (int (*)(REALcontrolInstance, long)) CallResolver("controlEnabledGetter");
- return (Boolean)pGetControlEnabled(instance, 0);
- }
-
- void REALSetControlVisible(REALcontrolInstance instance, unsigned long visible)
- {
- static void (*pSetControlVisible)(REALcontrolInstance, unsigned long) = nil;
- if (!pSetControlVisible)
- pSetControlVisible = (void (*)(REALcontrolInstance, unsigned long)) CallResolver("SetControlVisible");
- if (pSetControlVisible) pSetControlVisible(instance, visible);
- }
-
- REALgraphics REALGetControlGraphics(REALcontrolInstance instance)
- {
- static unsigned long (*pGetControlGraphics)(REALcontrolInstance) = nil;
- if (!pGetControlGraphics)
- pGetControlGraphics = (unsigned long (*)(REALcontrolInstance)) CallResolver("REALGetControlGraphics");
- if (pGetControlGraphics) return (REALgraphics)pGetControlGraphics(instance);
- else return (REALgraphics)0;
- }
-
- #if TARGET_WIN32
- int REALGetWin32Charset(void)
- {
- static int (*pGetWin32Charset)(void) = nil;
- if (!pGetWin32Charset)
- pGetWin32Charset = (int (*)(void)) CallResolver("REALGetWin32Charset");
- if (pGetWin32Charset) return pGetWin32Charset();
- else return (int)0;
- }
- #endif
-
- #if TARGET_WIN32
- REALfolderItem REALFolderItemFromPath(const char *path)
- {
- static unsigned long (*pFolderItemFromPath)(const char *) = nil;
- if (!pFolderItemFromPath)
- pFolderItemFromPath = (unsigned long (*)(const char *)) CallResolver("FolderItemFromPath");
- if (pFolderItemFromPath) return (REALfolderItem)pFolderItemFromPath(path);
- else return (REALfolderItem)0;
- }
- #endif
-
- #if TARGET_68K || TARGET_PPC || TARGET_CARBON
- REALfolderItem REALFolderItemFromFSSpec(const FSSpec *spec)
- {
- static unsigned long (*pFolderItemFromFSSpec)(const FSSpec *) = nil;
- if (!pFolderItemFromFSSpec)
- pFolderItemFromFSSpec = (unsigned long (*)(const FSSpec *)) CallResolver("FolderItemFromFSSpec");
- if (pFolderItemFromFSSpec) return (REALfolderItem)pFolderItemFromFSSpec(spec);
- else return (REALfolderItem)0;
- }
- #endif
-
- #if TARGET_68K || TARGET_PPC || TARGET_CARBON
- Boolean REALFSSpecFromFolderItem(FSSpec *spec, REALfolderItem item)
- {
- static Boolean (*pFSSpecFromFolderItem)(FSSpec *, REALfolderItem) = nil;
- if (!pFSSpecFromFolderItem)
- pFSSpecFromFolderItem = (Boolean (*)(FSSpec *, REALfolderItem)) CallResolver("REALFSSpecFromFolderItem");
- if (pFSSpecFromFolderItem) return pFSSpecFromFolderItem(spec, item);
- else return (Boolean)0;
- }
- #endif
-
- REALstring REALpathFromFolderItem(REALfolderItem item)
- {
- static unsigned long (*pPathFromFolderItem)(REALfolderItem) = nil;
- if (!pPathFromFolderItem)
- pPathFromFolderItem = (unsigned long (*)(REALfolderItem)) CallResolver("REALpathFromFolderItem");
- if (pPathFromFolderItem) return (REALstring)pPathFromFolderItem(item);
- else return (REALstring)0;
- }
-
- #if TARGET_WIN32
- HDC REALGraphicsDC(REALgraphics context)
- {
- static unsigned long (*pGraphicsDC)(REALgraphics) = nil;
- if (!pGraphicsDC)
- pGraphicsDC = (unsigned long (*)(REALgraphics)) CallResolver("REALGraphicsDC");
- if (pGraphicsDC) return (HDC)pGraphicsDC(context);
- else return (HDC)0;
- }
- #endif
-
- #if TARGET_WIN32
- HWND REALGetControlHWND(REALcontrolInstance control)
- {
- static HWND (*pGetControlHWND)(REALcontrolInstance) = nil;
- if (!pGetControlHWND)
- pGetControlHWND = (HWND (*)(REALcontrolInstance)) CallResolver("GetControlHWND");
- if (pGetControlHWND) return pGetControlHWND(control);
- else return (HWND)0;
- }
- #endif
-
- #if TARGET_68K || TARGET_PPC || TARGET_CARBON
- void REALSelectGraphics(REALgraphics context)
- {
- static void (*pSelectGraphics)(REALgraphics) = nil;
- if (!pSelectGraphics)
- pSelectGraphics = (void (*)(REALgraphics)) CallResolver("SelectGraphics");
- if (pSelectGraphics) pSelectGraphics(context);
- }
- #endif
-
- #if TARGET_68K || TARGET_PPC || TARGET_CARBON
- void REALGraphicsDrawOffscreenMacControl(REALgraphics context, ControlHandle mh)
- {
- static void (*pGraphicsDrawOffscreenMacControl)(REALgraphics, ControlHandle) = nil;
- if (!pGraphicsDrawOffscreenMacControl)
- pGraphicsDrawOffscreenMacControl = (void (*)(REALgraphics, ControlHandle)) CallResolver("DrawOffscreenMacControl");
- if (pGraphicsDrawOffscreenMacControl) pGraphicsDrawOffscreenMacControl(context, mh);
- }
- #endif
-
- void REALInvalidateControl(REALcontrolInstance instance)
- {
- static void (*pInvalidateControl)(REALcontrolInstance) = nil;
- if (!pInvalidateControl)
- pInvalidateControl = (void (*)(REALcontrolInstance)) CallResolver("REALInvalidateControl");
- if (pInvalidateControl) pInvalidateControl(instance);
- }
-
- void REALInvalidateControlRect(REALcontrolInstance instance, int left, int top, int right, int bottom)
- {
- static void (*pInvalidateControlRect)(REALcontrolInstance, int, int, int, int) = nil;
- if (!pInvalidateControlRect)
- pInvalidateControlRect = (void (*)(REALcontrolInstance, int, int, int, int)) CallResolver("REALInvalidateControlRect");
- if (pInvalidateControlRect) pInvalidateControlRect(instance, left, top, right, bottom);
- }
-
- #if TARGET_WIN32
- void REALSetSpecialBackground(REALcontrolInstance instance, COLORREF *pcolor)
- {
- static void (*pSetSpecialBackground)(REALcontrolInstance, COLORREF *) = nil;
- if (!pSetSpecialBackground)
- pSetSpecialBackground = (void (*)(REALcontrolInstance, COLORREF *)) CallResolver("REALSetSpecialBackground");
- if (pSetSpecialBackground) pSetSpecialBackground(instance, pcolor);
- }
- #endif
-
- #if TARGET_68K || TARGET_PPC || TARGET_CARBON
- void REALSetSpecialBackground(REALcontrolInstance instance)
- {
- static void (*pSetSpecialBackground)(REALcontrolInstance) = nil;
- if (!pSetSpecialBackground)
- pSetSpecialBackground = (void (*)(REALcontrolInstance)) CallResolver("REALSetSpecialBackground");
- if (pSetSpecialBackground) pSetSpecialBackground(instance);
- }
- #endif
-
- REALwindow REALGetControlWindow(REALcontrolInstance instance)
- {
- static REALwindow (*pGetControlWindow)(REALcontrolInstance) = nil;
- if (!pGetControlWindow)
- pGetControlWindow = (REALwindow (*)(REALcontrolInstance)) CallResolver("getControlWindow");
- if (pGetControlWindow) return pGetControlWindow(instance);
- else return (REALwindow)0;
- }
-
- #if TARGET_68K || TARGET_PPC || TARGET_CARBON
- REALsound REALBuildSoundFromHandle(Handle sound, Boolean bPassOwnership)
- {
- static REALsound (*pBuildSoundFromHandle)(Handle, Boolean) = nil;
- if (!pBuildSoundFromHandle)
- pBuildSoundFromHandle = (REALsound (*)(Handle, Boolean)) CallResolver("REALBuildSoundFromHandle");
- if (pBuildSoundFromHandle) return pBuildSoundFromHandle(sound, bPassOwnership);
- else return (REALsound)0;
- }
- #endif
-
- #if TARGET_68K || TARGET_PPC || TARGET_CARBON
- REALappleEvent REALBuildAppleEvent(const AppleEvent *event, Boolean bPassOwnership)
- {
- static unsigned long (*pBuildAppleEvent)(const AppleEvent *, Boolean) = nil;
- if (!pBuildAppleEvent)
- pBuildAppleEvent = (unsigned long (*)(const AppleEvent *, Boolean)) CallResolver("REALBuildAppleEvent");
- if (pBuildAppleEvent) return (REALappleEvent)pBuildAppleEvent(event, bPassOwnership);
- else return (REALappleEvent)0;
- }
- #endif
-
- #if TARGET_68K || TARGET_PPC || TARGET_CARBON
- REALappleEvent REALBuildAEDescList(const AppleEvent *event, Boolean bPassOwnership)
- {
- static unsigned long (*pBuildAEDescList)(const AppleEvent *, Boolean) = nil;
- if (!pBuildAEDescList)
- pBuildAEDescList = (unsigned long (*)(const AppleEvent *, Boolean)) CallResolver("REALBuildAEDescList");
- if (pBuildAEDescList) return (REALappleEvent)pBuildAEDescList(event, bPassOwnership);
- else return (REALappleEvent)0;
- }
- #endif
-
- #if TARGET_68K || TARGET_PPC || TARGET_CARBON
- REALappleEvent REALBuildAEObjSpecifier(const AppleEvent *event, Boolean bPassOwnership)
- {
- static unsigned long (*pBuildAEObjSpecifier)(const AppleEvent *, Boolean) = nil;
- if (!pBuildAEObjSpecifier)
- pBuildAEObjSpecifier = (unsigned long (*)(const AppleEvent *, Boolean)) CallResolver("REALBuildAEObjSpecifier");
- if (pBuildAEObjSpecifier) return (REALappleEvent)pBuildAEObjSpecifier(event, bPassOwnership);
- else return (REALappleEvent)0;
- }
- #endif
-
- #if TARGET_68K || TARGET_PPC || TARGET_CARBON
- AppleEvent *REALAccessAppleEvent(REALappleEvent event)
- {
- static unsigned long (*pAccessAppleEvent)(REALappleEvent) = nil;
- if (!pAccessAppleEvent)
- pAccessAppleEvent = (unsigned long (*)(REALappleEvent)) CallResolver("REALAccessAppleEvent");
- if (pAccessAppleEvent) return (AppleEvent *)pAccessAppleEvent(event);
- else return (AppleEvent *)0;
- }
- #endif
-
- #if TARGET_68K || TARGET_PPC || TARGET_CARBON
- AppleEvent *REALAccessAppleEventReply(REALappleEvent event)
- {
- static unsigned long (*pAccessAppleEventReply)(REALappleEvent) = nil;
- if (!pAccessAppleEventReply)
- pAccessAppleEventReply = (unsigned long (*)(REALappleEvent)) CallResolver("REALAccessAppleEventReply");
- if (pAccessAppleEventReply) return (AppleEvent *)pAccessAppleEventReply(event);
- else return (AppleEvent *)0;
- }
- #endif
-
- #if TARGET_68K || TARGET_PPC || TARGET_CARBON
- WindowPtr REALGetWindowHandle(REALwindow window)
- {
- static unsigned long (*pGetWindowHandle)(REALwindow) = nil;
- if (!pGetWindowHandle)
- pGetWindowHandle = (unsigned long (*)(REALwindow)) CallResolver("REALGetWindowHandle");
- if (pGetWindowHandle) return (WindowPtr)pGetWindowHandle(window);
- else return (WindowPtr)0;
- }
- #endif
-
- #if TARGET_68K || TARGET_PPC || TARGET_CARBON
- ControlHandle REALGetControlHandle(REALcontrolInstance control)
- {
- static unsigned long (*pGetControlHandle)(REALcontrolInstance) = nil;
- if (!pGetControlHandle)
- pGetControlHandle = (unsigned long (*)(REALcontrolInstance)) CallResolver("REALGetControlHandle");
- if (pGetControlHandle) return (ControlHandle)pGetControlHandle(control);
- else return (ControlHandle)0;
- }
- #endif
-
- #if TARGET_68K || TARGET_PPC || TARGET_CARBON
- MenuHandle REALGetPopupMenuHandle(REALpopupMenu popup)
- {
- static unsigned long (*pGetPopupMenuHandle)(REALpopupMenu) = nil;
- if (!pGetPopupMenuHandle)
- pGetPopupMenuHandle = (unsigned long (*)(REALpopupMenu)) CallResolver("REALGetPopupMenuHandle");
- if (pGetPopupMenuHandle) return (MenuHandle)pGetPopupMenuHandle(popup);
- else return (MenuHandle)0;
- }
- #endif
-
- MovieController REALgetMoviePlayerController(REALmoviePlayer instance)
- {
- static unsigned long (*pGetMoviePlayerController)(REALmoviePlayer) = nil;
- if (!pGetMoviePlayerController)
- pGetMoviePlayerController = (unsigned long (*)(REALmoviePlayer)) CallResolver("getMoviePlayerController");
- if (pGetMoviePlayerController) return (MovieController)pGetMoviePlayerController(instance);
- else return (MovieController)0;
- }
-
- Movie REALgetMovieMovie(REALmovie instance)
- {
- static unsigned long (*pGetMovieMovie)(REALmovie) = nil;
- if (!pGetMovieMovie)
- pGetMovieMovie = (unsigned long (*)(REALmovie)) CallResolver("getMovieMovie");
- if (pGetMovieMovie) return (Movie)pGetMovieMovie(instance);
- else return (Movie)0;
- }
-
- #if TARGET_68K || TARGET_PPC || TARGET_CARBON
- REALmovie REALbuildMovie(Movie movie, int resRefNum, int bNew)
- {
- static unsigned long (*pBuildMovie)(Movie, int, int) = nil;
- if (!pBuildMovie)
- pBuildMovie = (unsigned long (*)(Movie, int, int)) CallResolver("buildMovie");
- if (pBuildMovie) return (REALmovie)pBuildMovie(movie, resRefNum, bNew);
- else return (REALmovie)0;
- }
- #endif
-
- #if TARGET_68K || TARGET_PPC || TARGET_CARBON
- void REALmarkMovieDirty(REALmovie movie)
- {
- static void (*pMarkMovieDirty)(REALmovie) = nil;
- if (!pMarkMovieDirty)
- pMarkMovieDirty = (void (*)(REALmovie)) CallResolver("markMovieDirty");
- if (pMarkMovieDirty) pMarkMovieDirty(movie);
- }
- #endif
-
- int REALenterMovies(void)
- {
- static int (*pEnterMovies)(void) = nil;
- if (!pEnterMovies)
- pEnterMovies = (int (*)(void)) CallResolver("REALenterMovies");
- if (pEnterMovies) return pEnterMovies();
- else return (int)0;
- }
-
- REALobject REALnewInstance(const char *className)
- {
- static unsigned long (*pNewInstance)(const char *) = nil;
- if (!pNewInstance)
- pNewInstance = (unsigned long (*)(const char *)) CallResolver("PluginNewInstance");
- if (pNewInstance) return (REALobject)pNewInstance(className);
- else return (REALobject)0;
- }
-
- REALobject REALnewMemoryBlock(long sz)
- {
- static unsigned long (*pNewInstance)(long) = nil;
- if (!pNewInstance)
- pNewInstance = (unsigned long (*)(long))CallResolver("newMemoryBlock");
- if (pNewInstance) return (REALobject)pNewInstance(sz);
- else return (REALobject)0;
- }
-
- void REALMarkSocketUsage(void)
- {
- static void (*pMarkSocketUsage)(void) = nil;
- if (!pMarkSocketUsage)
- pMarkSocketUsage = (void (*)(void)) CallResolver("PluginMarkSocketUsage");
- if (pMarkSocketUsage) pMarkSocketUsage();
- }
-
- void REALSocketConnect(REALsocket socket, REALstring address, int port)
- {
- static void (*pSocketConnect)(REALsocket, REALstring, int) = nil;
- if (!pSocketConnect)
- pSocketConnect = (void (*)(REALsocket, REALstring, int)) CallResolver("");
- if (pSocketConnect) pSocketConnect(socket, address, port);
- }
-
- void REALSocketClose(REALsocket socket)
- {
- static void (*pSocketClose)(REALsocket) = nil;
- if (!pSocketClose)
- pSocketClose = (void (*)(REALsocket)) CallResolver("socketClose");
- if (pSocketClose) pSocketClose(socket);
- }
-
- REALstring REALSocketReadAll(REALsocket socket)
- {
- static unsigned long (*pSocketReadAll)(REALsocket) = nil;
- if (!pSocketReadAll)
- pSocketReadAll = (unsigned long (*)(REALsocket)) CallResolver("pluginSocketReadAll");
- if (pSocketReadAll) return (REALstring)pSocketReadAll(socket);
- else return (REALstring)0;
- }
-
- REALstring REALSocketRead(REALsocket socket, int count)
- {
- static unsigned long (*pSocketRead)(REALsocket, int) = nil;
- if (!pSocketRead)
- pSocketRead = (unsigned long (*)(REALsocket, int)) CallResolver("pluginSocketRead");
- if (pSocketRead) return (REALstring)pSocketRead(socket, count);
- else return (REALstring)0;
- }
-
- void REALSocketWrite(REALsocket socket, REALstring data)
- {
- static void (*pSocketWrite)(REALsocket, REALstring) = nil;
- if (!pSocketWrite)
- pSocketWrite = (void (*)(REALsocket, REALstring)) CallResolver("SocketWrite");
- if (pSocketWrite) pSocketWrite(socket, data);
- }
-
- int REALSocketLastErrorCode(REALsocket socket, int unused)
- {
- static int (*pSocketLastErrorCode)(REALsocket, int) = nil;
- if (!pSocketLastErrorCode)
- pSocketLastErrorCode = (int (*)(REALsocket, int)) CallResolver("socketLastErrorCode");
- if (pSocketLastErrorCode) return pSocketLastErrorCode(socket, unused);
- else return (int)0;
- }
-
- REALstring REALSocketLookahead(REALsocket socket, int unused)
- {
- static unsigned long (*pSocketLookahead)(REALsocket, int) = nil;
- if (!pSocketLookahead)
- pSocketLookahead = (unsigned long (*)(REALsocket, int)) CallResolver("pluginSocketLookahead");
- if (pSocketLookahead) return (REALstring)pSocketLookahead(socket, unused);
- else return (REALstring)0;
- }
-
- REALstring REALSocketLocalAddressGetter(REALsocket socket, int unused)
- { if (unused){};
- static REALstring (*pSocketLocalAddressGetter)(REALsocket, int);
- if (!pSocketLocalAddressGetter)
- pSocketLocalAddressGetter = (REALstring (*)(REALsocket, int)) CallResolver("socketLookahead");
- return pSocketLocalAddressGetter(socket, 0);
- }
-
- void REALSocketPoll(REALsocket socket)
- {
- static void (*pSocketPoll)(REALsocket) = nil;
- if (!pSocketPoll)
- pSocketPoll = (void (*)(REALsocket)) CallResolver("socketPoll");
- if (pSocketPoll) pSocketPoll(socket);
- }
-
- int REALSocketGetEvents(REALsocket socket, int unused)
- {
- static int (*pSocketGetEvents)(REALsocket, int) = nil;
- if (!pSocketGetEvents)
- pSocketGetEvents = (int (*)(REALsocket, int)) CallResolver("socketGetEvents");
- if (pSocketGetEvents) return pSocketGetEvents(socket, unused);
- else return (int)0;
- }
-
- void REALRegisterDataSourceInterface(const char *szMenuName, REALDataSourceInterfaceProc proc)
- {
- static void (*pRegisterDataSourceInterface)(const char *, REALDataSourceInterfaceProc) = nil;
- if (!pRegisterDataSourceInterface)
- pRegisterDataSourceInterface = (void (*)(const char *, REALDataSourceInterfaceProc)) CallResolver("RegisterDataSourceInterface");
- if (pRegisterDataSourceInterface)
- #ifdef USECALLSHELL
- pRegisterDataSourceInterface(szMenuName, buildEnvironmentShell(proc));
- #else
- pRegisterDataSourceInterface(szMenuName, proc);
- #endif
- }
-
- void REALRegisterDataSource(const char *szDatasourceName, REALDataSourceProc proc)
- {
- static void (*pRegisterDataSource)(const char *, REALDataSourceProc);
- if (!pRegisterDataSource)
- pRegisterDataSource = (void (*)(const char *, REALDataSourceProc)) CallResolver("RegisterDataSource");
- #ifdef USECALLSHELL
- pRegisterDataSource(szDatasourceName, (REALDataSourceProc) buildEnvironmentShell(proc));
- #else
- pRegisterDataSource(szDatasourceName, proc);
- #endif
- }
-
- void REALDesignAddDataSource(const char *baseName, const char *szDataSourceName, Ptr data, int dataLen)
- {
- static void (*pDesignAddDataSource)(const char *, const char *, Ptr, int) = nil;
- if (!pDesignAddDataSource)
- pDesignAddDataSource = (void (*)(const char *, const char *, Ptr, int)) CallResolver("DesignAddDataSource");
- if (pDesignAddDataSource) pDesignAddDataSource(baseName, szDataSourceName, data, dataLen);
- }
-
- void REALMessageBox(REALstring text)
- {
- static void (*pMessageBox)(REALstring) = nil;
- if (!pMessageBox)
- pMessageBox = (void (*)(REALstring)) CallResolver("RuntimeMsgBox");
- if (pMessageBox) pMessageBox(text);
- }
-
- #if TARGET_WIN32
- REALpicture REALBuildPictureFromDIB(HANDLE hDIB, Boolean bPassOwnership)
- {
- static unsigned long (*pBuildPictureFromDIB)(HANDLE, Boolean) = nil;
- if (!pBuildPictureFromDIB)
- pBuildPictureFromDIB = (unsigned long (*)(HANDLE, Boolean)) CallResolver("REALBuildPictureFromDIB");
- if (pBuildPictureFromDIB) return (REALpicture)pBuildPictureFromDIB(hDIB, bPassOwnership);
- else return (REALpicture)0;
- }
- #endif
-
- void REALSetControlEnabled(REALcontrolInstance instance, long unused, Boolean enable)
- {
- static void (*pSetControlEnabled)(REALcontrolInstance, long, Boolean) = nil;
- if (!pSetControlEnabled)
- pSetControlEnabled = (void (*)(REALcontrolInstance, long, Boolean)) CallResolver("controlEnabledSetter");
- if (pSetControlEnabled) pSetControlEnabled(instance, unused, enable);
- }
-
- long REALGetControlPosition(REALcontrolInstance instance, long which)
- {
- static unsigned long (*pGetControlPosition)(REALcontrolInstance, long) = nil;
- if (!pGetControlPosition)
- pGetControlPosition = (unsigned long (*)(REALcontrolInstance, long)) CallResolver("ctlPosGetter");
- if (pGetControlPosition) return (long)pGetControlPosition(instance, which);
- else return (long)0;
- }
-
- void REALSetControlPosition(REALcontrolInstance instance, long which, long value)
- {
- static void (*pSetControlPosition)(REALcontrolInstance, long, long) = nil;
- if (!pSetControlPosition)
- pSetControlPosition = (void (*)(REALcontrolInstance, long, long)) CallResolver("ctlPosSetter");
- if (pSetControlPosition) pSetControlPosition(instance, which, value);
- }
-
- // **** Autogenerated code from Plugin API Manager ends here ****
- // **************** Do not edit above this line *****************
- #pragma mark -
- #pragma mark PAM Code Above!
- #pragma mark -
-
- long REALstringToOSType(REALstring id)
- {
- long rv = ' ';
- int count = id->Length();
- if (count > 4)
- count = 4;
- BlockMove(id->CString(), &rv, count);
- return rv;
- }
-
- #ifdef powerc
- extern "C" {
- void __sinit(void); /* (generated by linker) */
- }
- #endif
-
- #ifdef WIN32
-
- extern "C" {
- void __declspec(dllexport) REALPluginMain(void *(*resolver)(const char *entryName));
- }
-
- void __declspec(dllexport) REALPluginMain(void *(*resolver)(const char *entryName))
- #else
- void main(void *(*resolver)(const char *entryName))
- #endif
- {
- // void (*pRegisterPluginExports)(REALexport *table);
- void (*pRegisterPluginVersion)(int version);
-
- #ifndef WIN32
- #if !CARBON // May 03 2000 -- GCC (1)
- EnterCodeResource();
- #endif // May 03 2000 -- GCC (1)
- #endif
-
- #ifdef powerc
- __sinit();
- #endif
-
- gResolver = resolver;
-
- #ifdef USECALLSHELL
- unsigned long (*getA4stack)(void);
-
- getA4stack = (unsigned long(*)(void)) resolver("getA4stackReference");
- a4stack = getA4stack();
- #else
- #ifndef WIN32
- #if CARBON // May 03 2000 -- GCC (1) -- Start
- gResolverPPC = (void *(*)(const char *)) gResolver("ResolverPPC");
- #else // May 03 2000 -- GCC (1) -- End
- gResolverPPC = (void *(*)(const char *)) CallUniversalProc((RoutineDescriptor *) gResolver, kThinkCStackBased | RESULT_SIZE(SIZE_CODE(4)) | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(4)), "ResolverPPC");
- #endif // May 03 2000 -- GCC (1)
- #endif
- #endif
-
- // pRegisterPluginExports = (void (*)(REALexport *)) CallResolver("RegisterPluginExports");
- // pRegisterPluginExports(pluginExports);
-
- pRegisterPluginVersion = (void (*)(int)) CallResolver("RegisterPluginVersion");
- pRegisterPluginVersion(kCurrentREALControlVersion);
-
- PluginEntry();
-
- #ifndef WIN32
- #if !CARBON // May 03 2000 -- GCC (1)
- ExitCodeResource();
- #endif // May 03 2000 -- GCC (1)
- #endif
- }
-
- long REALstringStruct::Length(void)
- {
- if (this)
- return mPrivateLength;
- else
- return 0;
- }
-
- const char *REALstringStruct::CString()
- {
- if (this)
- return (const char *) (mPrivateStringData + 1);
- else
- return "";
- }
-
- const unsigned char *REALstringStruct::PString()
- {
- if (this)
- return mPrivateStringData;
- else
- return "\p";
- }
-